package com.guchenbo.example.socket.nio;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.channels.SelectionKey;

/**
 * @Author guchenbo
 * @Date 2018/10/26.
 */
public class NioUtils {
    protected static final Logger log = LoggerFactory.getLogger(NioUtils.class);

    public static void log(SelectionKey key) {
        log.info("key: "
                        + key
                        + ", ready: "
                        + key.readyOps()
                        + ", channel: "
                        + key.channel()
                        + ", accept: "
                        + key.isAcceptable()
                        + ", connect: "
                        + key.isConnectable()
                        + ", read: "
                        + key.isReadable()
                        + ", write: "
                        + key.isWritable());
    }
}
